package org.codert.jpa.web;

import org.codert.jpa.event.MyEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: TanJingyu
 * @create: 2021-09-24 17:38
 **/
@RestController
@RequestMapping("/event")
public class EventController {
    @Autowired
    private ApplicationEventPublisher publisher;

    @GetMapping
    public String register() {
        publisher.publishEvent(new MyEvent("事件信息"));
        return "success";
    }
}
